import React, { Component, createRef } from 'react'

export default class App extends Component {
  state = {
    bBar: false
  }
  inputRef = createRef()
  handleClick = () => {
    this.setState({
      bBar: !this.state.bBar
    }, () => {
      this.inputRef.current.focus()
    })
  }
  render () {
    return (
      <div>
        App
        <div>
          {this.state.bBar ? (<input ref={this.inputRef} />) : (<button onClick={this.handleClick}>回复</button>)}
        </div>


      </div>
    )
  }
}